import 'package:flutter/material.dart';
import '../../widgets/AppColors.dart';

class AboutPage extends StatelessWidget {
  const AboutPage({super.key});

  static const array = ['服务协议', '隐私政策'];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: AppColors.backgroundColor,
      appBar: AppBar(
        title: const Text('关于'),
        backgroundColor: Colors.transparent,
        foregroundColor: AppColors.textPrimary,
        flexibleSpace: Container(
          decoration: const BoxDecoration(
            image: DecorationImage(
              image: AssetImage('assets/images/home/home_topbg.png'),
              fit: BoxFit.cover,
            ),
          ),
        ),
      ),
      body: Column(
        children: [
          Container(
            height: 112,
            margin: const EdgeInsets.all(15.0),
            decoration: BoxDecoration(
              color: AppColors.cardColor,
              borderRadius: BorderRadius.circular(10.0),
            ),
            child: ListView.builder(
              itemCount: array.length,
              shrinkWrap: true,
              physics: const NeverScrollableScrollPhysics(),
              itemBuilder: (context, index) {
                return GestureDetector(
                  onTap: () {},
                  child: _buildListItem(
                      array[index], '', index == array.length - 1),
                );
              },
            ),
          ),
        ],
      ),
    );
  }

  Widget _buildListItem(String title, String content, bool isLast) {
    return Container(
      padding: const EdgeInsets.all(15.0),
      height: 56,
      decoration: BoxDecoration(
        border: Border(
          bottom: isLast
              ? BorderSide.none
              : BorderSide(color: AppColors.dividerColor),
        ),
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween, // 使内容两端对齐
            children: [
              Row(
                children: [
                  Text(
                    title,
                    style: TextStyle(
                        fontSize: 16,
                        fontWeight: FontWeight.bold,
                        color: AppColors.textPrimary),
                  ),
                ],
              ),
            ],
          ),
        ],
      ),
    );
  }
}
